FROM node:12-alpine as builder

RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && apk add --no-cache git python make openssl tar gcc

COPY yapi.tar.gz /home

RUN cd /home && tar zxvf yapi.tar.gz && mkdir /api && mv /home/yapi-1.8.0 /api/vendors && ls -l /api/vendors

RUN cd /api/vendors && \
    npm i --production 
    # --registry https://registry.npm.taobao.org

FROM node:12-alpine

COPY --from=builder /api/vendors /api/vendors

WORKDIR /api/vendors

EXPOSE 3000

ENTRYPOINT ["node"]

CMD ["server/app.js"]